﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Sample02_Default : JavaScriptCodeBehind.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
        DataTable dt = new DataTable();
        dt.Columns.Add("CAR", Type.GetType("System.String"));

        DataRow dr = dt.NewRow();
        dr["CAR"] = "Palio";
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr["CAR"] = "Gol";
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr["CAR"] = "Celta";
        dt.Rows.Add(dr);

        this.Repeater1.DataSource = dt;
        this.Repeater1.DataBind();

        this.AddControlReference(this.Repeater1);

    }

    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
        {
            DataRowView drv = (DataRowView) e.Item.DataItem;

            Label Label1 = (Label) e.Item.FindControl("Label1");
            Label1.Text = drv["CAR"].ToString();
        }
    }
}
